var express = require('express');
var router= new express.Router();
var stockService = require('../service/stock')



router.post('/out',function (req,res) {
      console.log(req.body);
      stockService.stockOut(req.body,function (flag) {
          res.json({
              flag:flag
          });
      })
})

router.get('/list',function (req,res) {

 //   console.log(req.query);
    var query = {
        productName:req.query.product_name,
        model:req.query.model,
        unit:req.query.unit
    }

    //console.log(outBill);
    stockService.list(query,function (err,items) {
        res.json(items);
    })
})


module.exports = router;